package com.yowasa.xiuxian.engine.battle.enemy.strategy;

import com.google.common.collect.Lists;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.constant.XiuxianConstants;
import com.yowasa.xiuxian.engine.battle.strategy.BaseSpellStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@BS(name = "野伏众")
@Order(1006)
@Component
public class YeFuZhong extends BaseSpellStrategy {
    @Autowired
    private BattleHelper battleHelper;

    @Override
    public ElementEnum getElement() {
        return null;
    }

    @Override
    public void action(UserBattleContent first, UserBattleContent second, BattleContent content) {
        int dmg;
        String desc;

        int orgAtk = first.getBattleInfo().getAtk();
        int def = second.getBattleInfo().getDef();
        int atk = (int) (orgAtk * 1.5);
        //user.getElement().get("土") < XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY
        desc = RandomUtil.choice(Lists.newArrayList("瞬影斩","横斩","劈砍"));
        if("瞬影斩".equals(desc)){
            atk =  2 * atk;
        }
        dmg = battleHelper.calAtk(atk, def);
        battleHelper.autoAction(this, first, second, content, dmg, desc);
    }

    @Override
    public void limit(UserBO user) {
        throw new HandlerException("无法学习妖兽的攻击手段");
    }

    @Override
    public String limitDesc() {
        return "无";
    }

    @Override
    public String desc() {
        return  "落草为寇的流浪武人，虽然常被称为「野伏」，但并不隶属于某个统一的团体。\n" +
                "作为常年行走在武道上的人，有着精湛的剑术，如今却不将其用于正道。\n" +
                "为了生计与财富，有时候甚至会与盗宝团、愚人众沆瀣一气。\n\n" +
                "擅长物理攻击，技能组\n 瞬影斩，横斩，劈砍\n";
    }


}
